package com.zero.zutils
{
	import flash.geom.Point;
	
	import com.open.utils.StringUtils;

	public class BaseUtils
	{
		/**
		 * 通过“，”分解字符串 
		 * @param args
		 * @return 
		 * 
		 */		
		public static function stringToArray($args:String):Array
		{
			var resultArgs:Array = $args.split(",");
			for(var i:int = 0;i<resultArgs.length;i++)
			{
				StringUtils.trim(resultArgs[i]);
			}
			
			return resultArgs;
		}
		
		/**
		 * 通过“，”将字符串转换成point 
		 * @param $value
		 * @return 
		 * 
		 */		
		public static function stringToPoint($value:String):Point
		{
			var resultArgs:Array = stringToArray($value);
			var resultPoint:Point = new Point(resultArgs[0], resultArgs[1]);
			
			return resultPoint;
		}
		
		/**
		 * 设置对象 
		 * @param $defaultObj
		 * @param $newObj
		 * @return 
		 * 
		 */		
		public static function setObject($newObj:*, $defaultObj:*):*
		{
			if($newObj)
			{
				return $newObj;
			}
			else
			{
				return $defaultObj;
			}
		}
	}
}